package com.yxhl.zoume.core.coupon.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.yxhl.zoume.R;
import com.yxhl.zoume.common.ui.activity.base.BaseActivityWithToolBar;
import com.yxhl.zoume.core.coupon.fragment.CouponSelectFragment;
import com.yxhl.zoume.core.coupon.model.CouponSelectModel;

/**
 * Created by vhawk on 2016/11/4.
 */

public class CouponSelectActivity extends BaseActivityWithToolBar {

    private static final String KEY_COUPON_SELECT_PARAM = "COUPON_SELECT_PARAM";
    private CouponSelectModel couponSelectModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setToolbarTitle("选择优惠券");
        handleExtraParam();
        addFragment(R.id.frame_activity_coupon_select_body, CouponSelectFragment.newInstance(couponSelectModel));
    }

    private void handleExtraParam() {
        couponSelectModel = (CouponSelectModel) getIntent().getSerializableExtra(KEY_COUPON_SELECT_PARAM);
    }

    @Override
    protected void onHeaderLeftClick(View view) {
        finish();
    }

    @Override
    protected void onHeaderRightClick(View view) {
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_coupon_select;
    }

    @Override
    protected void initializeInjector() {

    }

    public static Intent getCallingIntent(Activity activity, CouponSelectModel couponSelectModel) {
        Intent intent = new Intent(activity, CouponSelectActivity.class);
        intent.putExtra(KEY_COUPON_SELECT_PARAM, couponSelectModel);
        return intent;
    }
}
